const numFormat1 = number => number.toLocaleString()

const numFormat2 = number => {
    let res = number.toString().replace(/\d+/, n => {
        return n.replace(/(\d)(?=(\d{3})+$)/g, ($1) => {
            return $1 + ",";
        });
    })
    return res
}

const numFormat3 = number => {
    const res = number.toString().replace(/\d+/, n => {
        return n.replace(/(\d)(?=(\d{3})+$)/g, $1 => {
            return $1 + ','
        })
    })
    return res
}


console.log(numFormat3(123123.2));